/* eslint-disable no-unused-vars */
import dayjs from "dayjs";

export const serverUrl = "http://localhost:3006";

export const setToken = (token) => sessionStorage.setItem("token", token);

export const getToken = () => sessionStorage.getItem("token");

export const removeToken = () => sessionStorage.removeItem("token");

export const dalImg = (url) => {
  if (url) {
    if (url.startsWith("http")) return url;
    return serverUrl + url;
  }
  return "http://t15.baidu.com/it/u=792111119,3355920578&fm=224&app=112&f=JPEG?w=500&h=500";
};

/**
 * 功能：日期格式化
 *
 * @param {*} date
 * @returns
 */
export const formatDate = (date) => dayjs(date).format("YYYY-MM-DD HH:mm:ss");

export const uploadAction=`${serverUrl}/common/upload`